<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\admin\controller;

/**
 * 财务控制器
 */
class Moneyapp extends AdminBase
{
    /**
     * 收款信息
     */
    public function bankinfo()
    {
        $data=$this->param;
        $info=db('user')->field('bank,bankCode,bankName,wx,zfb,is')->where('id',$data['user_id'])->find();
        if($info['is'] == 1){
            $s=db('dian')->field('type,account,name,wx_id,zfb_id')->where('user_id',$data['user_id'])->find();
            $info['bank']=$s['type'];
            $info['bankCode']=$s['account'];
            $info['bankName']=$s['name'];
            $info['wx']=get_picture_url($s['wx_id']);
            $info['zfb']=get_picture_url($s['zfb_id']);
        }
        $this->assign('info',$info );
        return $this->fetch('bankinfo');
    }
    /**
     * 提现列表
     */
    public function moneyappList()
    {
        $where = $this->logicMoneyapp->getWhere($this->param);
        $list=$this->logicMoneyapp->getMoneyappList($where);
        foreach($list as $k=>$v){
            if($v['is'] ==  1){
                $list[$k]['title']=db('dian')->where('user_id',$v['user_id'])->value('title');
            }
        }
        $this->assign('list',$list );       
        return $this->fetch('moneyapp_list');
    }
    /**
     * 商家提现列表
     */
    public function moneyappLists()
    {
        $where = $this->logicMoneyapp->getWhere($this->param,1);
        $list=$this->logicMoneyapp->getMoneyappList($where);
        foreach($list as $k=>$v){
            if($v['is'] ==  1){
                $list[$k]['title']=db('dian')->where('user_id',$v['user_id'])->value('title');
            }
        }
        $this->assign('list',$list );
        return $this->fetch('moneyapp_lists');
    }
    /**
     * 提现导出
     */
    public function exportMoneyappList()
    {
        
        $where = $this->logicMoneyapp->getWhere($this->param);

        $this->logicMoneyapp->exportMoneyappList($where);
    }
	/**
     * 数据状态设置
     */
    public function setStatus()
    {
        
        $this->jump($this->logicAdminBase->setStatus('user', $this->param));
    }
	/**
     * 数据状态设置
     */
    public function updateStat()
    {
        
        echo $this->logicMoneyapp->updateStat($this->param);
    }
}
